package  
{
	import org.flixel.*;
	/**
	 * ...
	 * @author morgan
	 */
	public class BossDialog extends FlxText
	{
		public static var stage1loss:Array = ["ha ha ha", "can't eat another bite?", "stick to dog food!"]
		public static var stage1win:Array = ["this is only the beginning, dog!", "you will regret this.", "i can't believe it!"];
		public static var stage2loss:Array = ["little dog no match for me", "go home little dog", "i... i feel bad for little dog", "bring coat next time"];
		public static var stage2win:Array = ["oof, where is my flask?", "uff! this not over, dog!", "it... so... cold..."];
		public static var stage3loss:Array = ["play dead, boy", "poor, poor, pup", "you don't belong here", "...and stay down."];
		public static var stage3win:Array = ["that was just the beginning", "ahh! prepare for my wrath!", "how can this be?!"];
		
		public var time:Number = 0;
		
		public function BossDialog() 
		{
			super(GameState.FIELDLEFT, 85, GameState.FIELDWIDTH, "", true);
			setFormat("visitor", 20, 0xffffff, "center", 0xff000000);
			visible = false;
		}
		
		public function showLoss():void
		{
			var quotes:Array;
			if (GameState.levelIndex < 3)
			{
				quotes = stage1loss;
			}
			else if (GameState.levelIndex < 6)
			{
				quotes = stage2loss;
			}
			else
			{
				quotes = stage3loss;
			}
			setText(quotes[int(Math.random() * quotes.length)]);
		}
		
		public function showWin():void
		{
			y = 85; velocity.y = -5;
			var quotes:Array;
			if (GameState.levelIndex < 3)
			{
				quotes = stage1win;
			}
			else if (GameState.levelIndex < 6)
			{
				quotes = stage2win;
			}
			else
			{
				quotes = stage3win;
			}
			setText(quotes[GameState.levelIndex % 3]);
		}
		
		public function setText(quote:String):void
		{
			text = quote;
			visible = true;
			time = 4;
		}
		
		override public function update():void 
		{
			time -= FlxG.elapsed;
			if (time < 0)
			{
				visible = false;
			}
			super.update();
		}
	}

}